package com.lhf.springcloud.service;

import com.lhf.springcloud.DAO.MajorDao;
import com.lhf.springcloud.Entity.MajorInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @ClassName: StorangeServiceImpl
 * @Description:
 * @Author: liuhefei
 * @Date: 2019/4/1
 * @blog: https://www.imooc.com/u/1323320/articles
 **/
@Service
public class MajorServiceImpl {


    @Autowired
    private MajorDao majorDao;

    public void addCourse(List<MajorInfo> course) {
        for (int i=0;i<course.size();i++){
            majorDao.addCourse(course.get(i));
        }

    }

    public List<MajorInfo> findAllMajorData() {
        List<MajorInfo> allMajorData = majorDao.findAllMajorData();
        return allMajorData;
    }

    public MajorInfo findByMajorNumberData(String majorNumber) {
        MajorInfo byMajorNumberData = majorDao.findByMajorNumberData(majorNumber);
        return byMajorNumberData;
    }
}
